/* 
 * File: item.h
 * Project: QTimeTracker
 * Author: Steve Sindelar, http://stevesindelar.cz
 * Licence: NewBSD licence.
 */

#ifndef ITEM_H
#define ITEM_H

#include <QString>
#include <QList>
#include "timespan.h"
#include "timespandata.h"


/**
 * Contains main data structures and algorithms, not GUI.
 */
namespace Core
{

	/**
	 * \ref Core::Item "Item" is named list of time spans with optional note.
	 */
	class Item
	{
	public:
		Item(QString name)
		{
			this->name = name;
		}

		QString name;
		QString note;
		QList<TimeSpan> timeSpans;

		/**
		 * Returns sum of lengths of all spans.
		 */
		TimeSpanData getLength() const;
		/**
		 * Indicates whether the last span is running or is stopped.
		 * Note: only last span might be running.
		 */
		bool isRunning() const;
	};

}

#endif // ITEM_H
